<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('channels', function (Blueprint $table) {
            $table->id('channel_id')->comment('渠道id');
            $table->string('name')->default('')->comment('渠道名称');
            $table->string('type')->default(1)->comment('渠道类型 1 小程序,2 APP ..');
            $table->string('appid')->comment('渠道appid , 可以是小程序appid 等等,未录入提示未授权');
            $table->string('secret')->default('')->comment('秘钥');
            $table->string('app_key')->comment('客户端加密秘钥');
            $table->string('iv')->comment('16位');
            $table->timestamps();
            $table->index('appid', 'idx_appid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('channels');
    }
};
